package com.zy.web.demo.duoxiancheng.demo30;

import java.util.concurrent.locks.ReentrantLock;

/**
 * @author <a href="mailto:zhouyong@cqyyt.com">zy</a>
 * @version 1.0
 * @date 2020/9/2 15:22
 */
public class Service30 {

    public ReentrantLock lock = new ReentrantLock();

    public void method(){
        lock.lock();
        try {
            System.out.println("线程："+Thread.currentThread().getName()+"进入等待");
            Thread.sleep(Integer.MAX_VALUE);
        }catch (InterruptedException e){
            e.printStackTrace();
        }finally {
            lock.unlock();
        }
    }

}
